package learn_design_patterns.templatemethod.sort;

public class Duck 
implements Comparable<Duck> 
{
	private String name;
	private int weight;

	public Duck(String name, int weight) {
		this.name = name;
		this.weight = weight;
	}

	@Override
	public String toString() {
		return name + " weights " + weight;
	}

	@Override
	public int compareTo(Duck o) {
		return (weight < o.weight) ? -1 : ((weight == o.weight) ? 0 : 1);
	}

}
